package com.tmpt.dto;

import com.tmpt.utils.DateTool;
import net.sf.json.JSONArray;
import org.json.JSONML;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Result<T> implements Serializable{
	private static final long serialVersionUID = 1L;

	private List<T> resultList = new ArrayList<T>();
	private T resultObj = null;

	private Map<String,Object> resultMap = new HashMap<String, Object>();
	private String remark;

	public boolean isSuccess(){
		if(resultMap.get("responseCode")==null)return false;

		if((Integer)resultMap.get("responseCode") == 1){
			return true;
		}else{
			return false;
		}
	}

	public String getContent(){
		return (String)resultMap.get("responseContent");
	}
	public String getContentOnly(){
		return (String)resultMap.get("responseContentOnly");
	}

	public Result success(String ... reasons){
		resultMap.put("responseCode", 1);

		if(reasons==null || reasons.length==0){
			resultMap.put("responseContent", "操作成功");
			resultMap.put("responseContentOnly", "");
		}else{
			resultMap.put("responseContent", "操作成功:"+reasons[0]);
			resultMap.put("responseContentOnly", reasons[0]);
		}
		return this;
	}

	public Result fault(String ... reasons){
		resultMap.put("responseCode", 0);
		if(reasons==null || reasons.length==0){
			resultMap.put("responseContent", "操作失败");
			resultMap.put("responseContentOnly", "");
		}else{
			resultMap.put("responseContent", "操作失败:"+reasons[0]);
			resultMap.put("responseContentOnly", reasons[0]);
		}
		return this;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Map<String, Object> getResultMap() {
		return resultMap;
	}

	public void setResultMap(Map<String, Object> resultMap) {
		this.resultMap = resultMap;
	}

	public List<T> getResultList() {
		return resultList;
	}

	public void setResultList(List<T> resultList) {
		this.resultList = resultList;
	}

	public T getResultObj() {
		return resultObj;
	}

	public void setResultObj(T resultObj) {
		this.resultObj = resultObj;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public static void main(String[] args) {
//		//Object o = null;
//		Result r = new Result();
//		r.success(null);
//		r.fault(null);

//		List<Integer> list = new ArrayList<>();
//		String source = "[1,2]";
//		System.out.println("source："+source);
//		String s1 = source.replaceAll(" ", "").replaceAll("\\[", "").replaceAll("\\]", "");
//		String[] split = s1.split(",");
//		System.out.println("split"+split);
//
//		for (int i = 0;i< split.length;i++){
//
//			list.add(Integer.parseInt(split[i]));
//		}
//		System.out.println(list);

//		List list = new ArrayList();
//		for (int i=0;i<=10;i++){
//
//			Map<String,String>  hashMap = new HashMap<>();
//			hashMap.put("lng","121.550051");
//			hashMap.put("lat","31.15446");
//			hashMap.put("createtime", DateTool.getCurrentDate().toString());
//			list.add(hashMap);
//		}
//		JSONArray json = JSONArray.fromObject(list);
//		System.out.println(json);

//		String s = "121.505361,31.244144;121.505679,31.244213;121.505816,31.243834;121.506057,31.243356;121.506503,31.243048;121.507379,31.242832;121.508748,31.241084;121.513781,31.233103;121.511308,31.232311;121.508631,31.231381;121.504731,31.230672;121.50316,31.2301;121.501548,31.231299;121.501513,31.231433;121.499854,31.232819;121.499565,31.233059;121.499513,31.233043;121.499386,31.233148;121.499396,31.233219;121.49918,31.23339;121.49892,31.233508;121.498868,31.233511;121.49874,31.233405;121.498584,31.233535;121.49843,31.233674;121.498103,31.233953;121.49722,31.234752;121.497122,31.234686;121.497019,31.23463;121.496557,31.235112;121.496019,31.23569;121.496028,31.235951;121.495789,31.236361;121.49588,31.236403;121.495669,31.236824;121.495453,31.236748;121.495213,31.237165;121.495235,31.237203;121.495244,31.237255;121.495226,31.23733;121.495218,31.237401;121.495177,31.237626;121.495155,31.237798;121.495149,31.237979;121.495152,31.238158;121.495175,31.238332;121.495208,31.238544;121.495189,31.238549;121.495171,31.238547;121.495194,31.238661;121.49527,31.238969;121.495317,31.238958;121.495325,31.238994;121.495447,31.239336;121.495614,31.239328;121.496012,31.240212;121.496619,31.240792;121.49772,31.241399;121.49891,31.241931;121.50097,31.242716;121.500892,31.242909;121.50098,31.242961;121.502033,31.24335;121.503107,31.243693;121.505283,31.24432"
//				;
//
//		String[] arr = s.split(";");
//		for(int i=0;i<arr.length;i++){
//			System.out.print("[");
//			System.out.print(arr[i]);
//			System.out.println("],");
//		}

//		String s = "无|无|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德|秦聚德"
//				;
//
//		String[] arr = s.split("|");
//		System.out.println(arr);
//		for(int i=0;i<arr.length;i++){
//
//			System.out.println(arr[i]);
//
//		}

		String s= "OriginID,TASKID,HOTLINESN,DISPATCHDEPTCODE,DISPATCHDEPTNAME,STATUSNAME,REPORTDEPTNAME,INFOSOURCENAME,INFOTYPENAME,INFOBCNAME,INFOSCNAME,INFOZCNAME,INFOATNAME,STREETNAME,COMMUNITYNAME,WORKGRID,COORDX,COORDY,ACCEPTTIME,ACCEPTTIME_F,ADDRESS,ALLENDTIME,APPEALTYPE,APPEALTYPENAME,ARRIVETIME,ARRIVETIME_F,CASEEND,CASEVALUATION,CONTACTINFO,CREATETIME,DEPTCODE,DEPTNAME,DEPTTAG,DEPTTAG_F,DESCRIPTION,DISCOVERTIME,DISPATCHDEPTCODE_F,DISPATCHDEPTNAME_F,DISPATCHNOTE,DISPATCHNOTE_F,DISPATCHUSER,DISPATCHUSER_F,ENDTIME,EXECDEPTNAME,EXECUTEDEPTCODE,EXPSATISFACTION,EXPSATISFACTIONNAME,FACILITYTYPE,FACILITYTYPE_F,FACILITYTYPENAME,FACILITYTYPENAME_F,FACTTYPE,FACTTYPENAME,FIRSTCONTACTTIME,FIRSTCONTACTTIME_F,FIRSTCONTACTTIMENAME,FIRSTCONTACTTIMENAME_F,GRIDCODE,IMPORTANTSOLVINGTIME,IMPORTANTSOLVINGTIME_F,INSERTDEPTCODE,INSERTDEPTNAME,ISCONTACT,ISCONTACT_F,ISDELAY,ISDELAY_F,ISFAST,ISFIRSTCONTACT,ISLASTDISPATCH,ISLASTDISPATCH_F,ISLASTEXEC,ISLASTEXEC_F,ISREWORK,ISREWORK_F,ISSOLVING,JZLASTDISPATCH,JZLASTDISPATCH_F,KEEPERNAME,KEEPERSN,LASTSOLVINGTIME,LASTSOLVINGTIME_F,LASTTAKECASETIME,LASTTAKECASETIME_F,MANYITYPE,MANYITYPE_F,MANYITYPENAME,MANYITYPENAME_F,MIDDLESOLVINGTIME,MIDDLESOLVINGTIME_F,PERCREATETIME,PEXECUTEDEPTCODE,PEXECUTEDEPTCODE_F,PLATLEVEL,PLATLEVEL_F,RECEIVETIME,RECEIVETIME_F,REPLAYFORM,REPLAYFORM_F,REPORTER,SIMILARCASESN,SOLVEKEEPERSN,SOLVEKEEPERSN_F,SOLVINGNOTE,SOLVINGNOTE_F,SOLVINGNUM,SOLVINGNUM_F,SOLVINGRESULT,SOLVINGRESULT_F,SOLVINGSTATUS,SOLVINGSTATUS_F,SOLVINGSTATUSNAME,SOLVINGSTATUSNAME_F,SOLVINGTIME,SOLVINGTIME_F,SOLVINGUSER,SOLVINGUSER_F,SPEICALSIGN,STATISTICALDEPTNAME,STATISTICALDEPTNAME_F,TELASKTIME,URGENTDEGREE,USEREVALUATE,USEREVALUATENAME,SYNCTIME";
		String[] arr = s.split(",");
		for(int i=0;i<arr.length;i++){

			System.out.println(arr[i].toLowerCase()+"ctc");

		}
	}
}
